local hx__guangsuti = fk.CreateSkill{
    name = "hx__guangsuti",

    tags = {Skill.Combo},
}

hx__guangsuti:addEffect(fk.AfterSkillEffect,{
    can_refresh = function (self, event, target, player, data)
        return player:hasSkill(hx__guangsuti.name) and target and target == player
    end,
    on_refresh = function (self, event, target, player, data)
        local room = player.room
        if player:getMark("@hx__guangsuti_combo") == 0 then
            if data.skill and data.skill.name ~= "hx__shanguangren" and data.skill.name ~= hx__guangsuti.name and data.skill.visible and not data.skill.attached_equip and data.skill:isPlayerSkill(player) and player:hasShownSkill(data.skill, true) and data ~= self then
                room:setPlayerMark(player,"@hx__guangsuti_combo",1)
            end
        elseif player:getMark("@hx__guangsuti_combo") == 1 then
            if data.skill and data.skill.name ~= "hx__shanguangren" and data.skill.visible and not data.skill.attached_equip and data.skill:isPlayerSkill(player) and player:hasShownSkill(data.skill, true) then
                room:setPlayerMark(player,"@hx__guangsuti_combo",0)
            end
        end
    end,
})

hx__guangsuti:addEffect(fk.SkillEffect,{
    can_trigger = function (self, event, target, player, data)
        return player:usedSkillTimes(hx__guangsuti.name,Player.HistoryGame) <= 3 and player:hasSkill(hx__guangsuti.name) and target and target == player and data.skill:getSkeleton().name == "hx__shanguangren" and  player:getMark("@hx__guangsuti_combo") == 1
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        local room = player.room
        room:setPlayerMark(player,"@hx__guangsuti_combo",0)
        local to = room:askToChoosePlayers(player,{ min_num = 1, max_num = 1, targets = room:getOtherPlayers(player), skill_name = hx__guangsuti.name, cancelable = false, prompt = "#hx__guangsuti__evoke", })
        room:addTableMarkIfNeed(player,"hx__guangsuti__tars",to[1].id)
        room:moveSeatTo(player,to[1]:getNextAlive().seat,false)
        room:useCard({
            from = player,
            tos = to,
            card = Fk:cloneCard("thunder__slash"),
            disresponsiveList = room.alive_players,
        })
    end,
})

hx__guangsuti:addEffect(fk.CardUseFinished,{
    can_refresh = function (self, event, target, player, data)
        return player:hasSkill(hx__guangsuti.name) and target and target == player
    end,
    on_refresh = function (self, event, target, player, data)
        local room = player.room
        if player:getMark("@hx__guangsuti_combo") == 0 then
            if data.card.trueName == "slash" then
                room:setPlayerMark(player,"@hx__guangsuti_combo",1)
            end
        end
    end,
})

return hx__guangsuti